﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using iOak.Business.Resumes;
using iOak.Business.Campaigns;
using iOak.Web.TemplateHelper;
using iOak.Domain.Campaigns;

namespace iOak.Web.ResumeTemplates
{
    public partial class CollegeTemplateView : BaseUserControl
    {
        public override void BindData(Guid resumrTemplateId, Guid resumeId)
        {
            ResumeDetailService itemResumeDetailService = new ResumeDetailService();
            // 获取模板对象
            var listTemplate = TemplateCommonViewHelper.GetTemplateFileList(resumrTemplateId);
            // 根据ID获取值
            var valueList = itemResumeDetailService.GetListByResumeId(resumeId);
            // 绑定数据
            TemplateCommonViewHelper.InitializationTemplate(listTemplate, this, valueList);
            //获取Bounty
            ApplicationCandidateService applicationCandidateService = new ApplicationCandidateService();
            ApplicationCandidate applicationCandidate = applicationCandidateService.GetByResumeId(resumeId);
            ApplicationService applicationService = new ApplicationService();
            ApplicationBase applicationBase = applicationService.Retrieve(applicationCandidate.ApplicationId);
            CampaignService campaignService = new CampaignService();
            var item = campaignService.Retrieve(applicationBase.CampaignId);
            hidBounty.Value = Convert.ToString(item.Bounty);
        }
    }
}